

import os

fout = open('./所有的小电影.txt', "w")

for root, dirs, files in os.walk("D:\\software\\临时文件夹"):
    for file in files:
        file_path = os.path.join(root, file)
        print(file_path)
        if file.endswith(".avi"):
            fout.write(file_path + "\n")

fout.close()